// 2025/7/24
// DNA序列

#include <iostream>
using namespace std;

int main() {
    string dna; 
    int len, cnt = 0, mcnt = 0, ans = 0;
    cin >> dna >> len;
    for(int i = 0; i < len; i++)
    {
        if(dna[i] == 'G' || dna[i] == 'C')
            cnt++;
    }
    mcnt = cnt;

    int n = dna.size();
    for(int i = len; i < n; i++)
    {
        if(dna[i] == 'G' || dna[i] == 'C')
            cnt++;
        if(dna[i - len] == 'G' || dna[i - len] == 'C')
            cnt--;
        if(cnt > mcnt)
        {
            mcnt = cnt;
            ans = i - len + 1;
        }
    }
    cout << dna.substr(ans, len) << endl;
    return 0;
}
// 64 位输出请用 printf("%lld")